package jk.spider.core.event.impl;

import jk.spider.core.SpiderController;
import jk.spider.core.event.CoreEventVisitor;
import jk.spider.model.ProxyInfo;
import jk.spider.model.Resource;

public class URLSpideredProxyOkEvent extends BaseCoreEventImpl {
	protected Resource resource;
	protected byte[] bytes;
	protected int httpStatus;
	protected String contentType;
	protected ProxyInfo proxyInfo;
	
	public URLSpideredProxyOkEvent(SpiderController controller, Resource resource, ProxyInfo proxyInfo, int httpStatus, String contentType, byte[] bytes) {
		super(controller, resource);
		this.resource = resource;
		this.proxyInfo = proxyInfo;
		this.httpStatus = httpStatus;
		this.contentType = contentType;
		this.bytes = bytes;
		resource.setBytes(bytes);
		proxyInfo.setSuccess();
	}

	public void accept(Resource resource, CoreEventVisitor visitor) {
		visitor.visit(resource, this);
	}

	public byte[] getBytes() {
		return bytes;
	}
	
	public ProxyInfo getProxyInfo() {
		return proxyInfo;
	}

	public int getHttpStatus() {
		return httpStatus;
	}

	public String getContentType() {
		return contentType;
	}
	
	public Resource getResource() {
		return resource;
	}
	
}
